/*
 * \brief  PCI session interface
 * \author Norman Feske
 * \date   2008-01-28
 */

/*
 * Copyright (C) 2008-2009 Norman Feske
 * Genode Labs, Feske & Helmuth Systementwicklung GbR
 *
 * This file is part of the Genode OS framework, which is distributed
 * under the terms of the GNU General Public License version 2.
 */

#ifndef _INCLUDE__PCI_SESSION__PCI_SESSION_H_
#define _INCLUDE__PCI_SESSION__PCI_SESSION_H_

#include <pci_device/capability.h>

namespace Pci {

	class Session
	{
		protected:

			enum Opcode { FIRST_DEVICE, NEXT_DEVICE, RELEASE_DEVICE };

		public:

			static const char *service_name() { return "PCI"; }

			virtual ~Session() { }

			/**
			 * Find first accessible device
			 */
			virtual Device_capability first_device() = 0;

			/**
			 * Find next accessible device
			 *
			 * \param prev_device  previous device
			 *
			 * The 'prev_device' argument is used to iterate through all
			 * devices.
			 */
			virtual Device_capability next_device(Device_capability prev_device) = 0;

			/**
			 * Free server-internal data structures representing the device
			 *
			 * Use this function to relax the heap partition of your PCI session.
			 */
			virtual void release_device(Device_capability device) = 0;
	};
}

#endif /* _INCLUDE__PCI_SESSION__PCI_SESSION_H_ */
